
const dbOps = require('@/utils/mysql.operate.js');
async function createUser(userData) {
    const result = await dbOps.add('user', userData);
    return result;
}

async function findUser(phoneNum) {
    const result = await dbOps.getOne('user', { phone: phoneNum });
    return result;
}

// async function login(phone) {
//     const user = await User.findOne({ phone });
//     return user;
// }


// async function findByUserPhoneOrEmail(payload) {
//     const { phone, email } = payload
//     const user = await User.findOne({ $or: [{ phone: phone }, { email: email }] });
//     return user;
// }

// async function verify(payload) {
//     const { phone } = payload;
//     const user = await User.updateOne({ phone: phone }, {actived:true} )
//     return user;
// }



// async function updateUser(payload) {
//     const { userId, updatedFields } = payload
//     const user = await User.updateOne({ userId: userId }, updatedFields )
//     return user;
// }

// async function queryOne(phone) {
//     const user = await User.findOne(phone);
//     return user;
// }

// async function deleteUser(payload) {
//     const { id } = payload
//     const result = await User.deleteOne({ _id: id });
//     return result;
// }

// async function resetpassword(payload) {
//     const { userId, updatedFields } = payload
//     const user = await User.updateOne({ userId: userId }, updatedFields )
//     return user;
// }



module.exports = { 
    createUser,
    findUser,
};




